package jmu.edu.cn.action;

import java.util.List;

import com.opensymphony.xwork2.ActionSupport;

import jmu.edu.cn.domain.DeviceType;
import jmu.edu.cn.service.DeviceTypeService;
import jmu.edu.cn.service.DeviceTypeServiceImpl;

public class DeviceTypeAction extends ActionSupport {
	private DeviceType devType;
	private List<DeviceType> devTypeList;

	public DeviceType getDevType() {
		return devType;
	}

	public void setDevType(DeviceType devType) {
		this.devType = devType;
	}
	
	
	public List<DeviceType> getDevTypeList() {
		return devTypeList;
	}

	public void setDevTypeList(List<DeviceType> devTypeList) {
		this.devTypeList = devTypeList;
	}

	public String toAdd() throws Exception {
		return "add_page";
	}

	public String add() throws Exception {
		DeviceTypeService service = new DeviceTypeServiceImpl();
		service.addDevType(devType);
		return "loadAllAct";
	}
	public String loadAll() throws Exception{
		DeviceTypeService service = new DeviceTypeServiceImpl();
		devTypeList=service.loadDevType();
		return "list_page";
	}
	
	public String removeDevType() throws Exception{
		DeviceTypeService service = new DeviceTypeServiceImpl();
		service.removeDevType(devType.getDevTypeNo());
		return "loadAllAct";
	}
}
